home *** CD-ROM | disk | FTP | other *** search
- Path: news.sprintlink.net!datalytics!usenet
- From: Rob Stewart <stew@datalytics.com>
- Newsgroups: comp.lang.c++
- Subject: Re: Coding Standards
- Date: Fri, 22 Mar 1996 13:17:32 -0500
- Organization: Datalytics, Inc
- Message-ID: <3152EEBC.3F9F@datalytics.com>
- References: <4hj8ek$elu@sam.inforamp.net> <4hktar$5o2@galaxy.ucr.edu> <4hmqol$97j@abacus.abasoft.co.uk> <4hsg8r$pmm@sam.inforamp.net> <4i9o6j$p4l@daisy.pgh.wec.com> <4idskb$pc1@sam.inforamp.net> <314EBD08.43BC@virtus.com> <4io2i7$n9v@sam.inforamp.net>
- NNTP-Posting-Host: 204.62.224.71
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.0 (WinNT; I)
-
- Randy Charles Morin wrote:
- >
- > In article <314EBD08.43BC@virtus.com>,
- > "Richard F. Albury" <richard.albury@virtus.com> wrote:
- > >// is the standard C++ comment, so I'm not sure I understand your objection.
- >
- > What I meant was that the /* */ has been the only standard comment for years.
- > The // comment style is a new proposed standard.
- >
-
- It may only be formalized in a standard in the future, but it
- has been part of every C++ compiler since the beginning. That
- makes it a de facto standard. This industry has many de facto
- standards upon which we all rely daily.
-
- > >> -a class which can be instantiated with a "new" must have a copy
- > >> constructor, a destructor and an assignment operator definition.
- > >
- > >It's good discipline. Read Scott Meyers' books for more info.
- >
-
- Perhaps it's good discipline, but a copy c'tor and assignment op
- are useful only when you wish to grant that capability. (To
- deny it, you must declare them private and not implement them,
- of course.) What I want to know is why instantiating an object
- on the heap requires them.
-
- > Unfortunately, if we follow everybodies good discipline guidelines, we would
- > miss our October deadline by a few years.
- >
- > >> -optimize code only when you have a problem.
- > >> Why not anticipate the problem?
- > >
- > >You rarely can. Read Plauger's writings on style. One of his sayings is
- > >"First make it right, then make it fast." If performance is an issue, use a
- > >profiler.
- >
- > You are right. But the standard explicitly stated that no optimization could
- > be done until there was a problem. I'd hate to see that problem in the field.
- > I'd rather anticipate the problem, most likely by doing exactly what you
- > suggested.
- >
- > >> -access functions are to be inline.
- > >> This is the biggest fallacy in programming today. If you make your
- > >> accessors inline, then you have defeated the purpose of data hiding. If
- > >> your data's type changes, then you still have to recompile every object
- > >> that accesses the member.
- > >
- > >Agreed.
- >
-
- Compilation firewalls are useful to prevent significant
- recompilation and offer the ability to augment a simple function
- later with more logic to retain the interface in light of an
- implementation change. However, performance is also an issue.
- If all accessor functions are left as non-inline function calls,
- then your code will bloat and perform worse.
-
- The maturity of a class and its use must be considered when
- deciding to inline an accessor. If the class is well
- established and is unlikely to change, inline accessors make
- great sense.
-
- > Thank you. I have a hard time convincing anybody of this.
- >
- > Agrivar
-
- --
- Robert Stewart | My opinions are usually my own.
- Datalytics, Inc. | stew@datalytics.com
-